import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

const login = r =>
    require.ensure([], () => r(require("@/page/login")), "login");
const manage = r =>
    require.ensure([], () => r(require("@/page/manage")), "manage");
const home = r => require.ensure([], () => r(require("@/page/home")), "home");
const addShop = r =>
    require.ensure([], () => r(require("@/page/addShop")), "addShop");
const addGoods = r =>
    require.ensure([], () => r(require("@/page/addGoods")), "addGoods");
const userList = r =>
    require.ensure([], () => r(require("@/page/userList")), "userList");
// 新增
const carduserList = r =>
    require.ensure([], () => r(require("@/page/carduserList")), "carduserList");
const rpairBills = r =>
    require.ensure([], () => r(require("@/page/rpairBills")), "rpairBills");
const frozenBills = r =>
    require.ensure([], () => r(require("@/page/frozenBills")), "frozenBills");
// 20181023 by link 新增 日汇总，员工推荐报表，门店汇总支付明细
const QueryRj = r =>
    require.ensure([], () => r(require("@/page/QueryRj")), "QueryRj");
const QueryTJ = r =>
    require.ensure([], () => r(require("@/page/QueryTJ")), "QueryTJ");
const QueryMDJX = r =>
    require.ensure([], () => r(require("@/page/QueryMDJX")), "QueryMDJX");
const QueryMDHZJX = r =>
    require.ensure([], () => r(require("@/page/QueryMDHZJX")), "QueryMDHZJX");

const adminPersons = r =>
    require.ensure([], () => r(require("@/page/adminPersons")), "adminPersons");
const adminPersonPwd = r =>
    require.ensure(
        [],
        () => r(require("@/page/adminPersonPwd")),
        "adminPersonPwd"
    );

/* const shopList = r => require.ensure([], () => r(require('@/page/shopList')), 'shopList'); */
const foodList = r =>
    require.ensure([], () => r(require("@/page/foodList")), "foodList");
const orderList = r =>
    require.ensure([], () => r(require("@/page/orderList")), "orderList");
const adminList = r =>
    require.ensure([], () => r(require("@/page/adminList")), "adminList");
const visitor = r =>
    require.ensure([], () => r(require("@/page/visitor")), "visitor");
const newMember = r =>
    require.ensure([], () => r(require("@/page/newMember")), "newMember");
const uploadImg = r =>
    require.ensure([], () => r(require("@/page/uploadImg")), "uploadImg");
const vueEdit = r =>
    require.ensure([], () => r(require("@/page/vueEdit")), "vueEdit");
const adminSet = r =>
    require.ensure([], () => r(require("@/page/adminSet")), "adminSet");
const sendMessage = r =>
    require.ensure([], () => r(require("@/page/sendMessage")), "sendMessage");
const explain = r =>
    require.ensure([], () => r(require("@/page/explain")), "explain");
const mallList = r =>
    require.ensure([], () => r(require("@/page/mall")), "mallList");
const tick = r => require.ensure([], () => r(require("@/page/tick")), "tick");
const tickList = r =>
    require.ensure([], () => r(require("@/page/ticklist")), "tickList");
const refundReason = r =>
    require.ensure([], () => r(require("@/page/refundReason")), "refundReason");
const sysRoleList = r =>
    require.ensure([], () => r(require("@/page/sysRole")), "sysRole");
const skfsList = r =>
    require.ensure([], () => r(require("@/page/skfs")), "skfsList");
const shopList = r =>
    require.ensure([], () => r(require("@/page/shopList")), "shopList");
const spflList = r =>
    require.ensure([], () => r(require("@/page/spflList")), "spflList");
const spsbList = r =>
    require.ensure([], () => r(require("@/page/spsb")), "spsbList");
const sktList = r =>
    require.ensure([], () => r(require("@/page/skt")), "sktList");
const goodsList = r =>
    require.ensure([], () => r(require("@/page/goods")), "goodsList");
const personList = r =>
    require.ensure([], () => r(require("@/page/personInfo")), "personList");
const xtczyList = r =>
    require.ensure([], () => r(require("@/page/xtczy")), "xtczyList");
const coupGrantRuleList = r =>
    require.ensure(
        [],
        () => r(require("@/page/coupGrantRule")),
        "coupGrantRuleList"
    );
const coupPayRuleList = r =>
    require.ensure(
        [],
        () => r(require("@/page/coupPayRule")),
        "coupPayRuleList"
    );
const yhqffdList = r =>
    require.ensure([], () => r(require("@/page/yhqffd")), "yhqffdList");
const coupDefList = r =>
    require.ensure([], () => r(require("@/page/coupDef")), "coupDefList");
const yhqsydList = r =>
    require.ensure([], () => r(require("@/page/yhqsyd")), "yhqsydList");

const shopSaleDetailList = r =>
    require.ensure(
        [],
        () => r(require("@/page/shopSaleDetail")),
        "shopSaleDetailList"
    );

const routes = [
    {
        path: "/",
        component: login
    },
    {
        path: "/manage",
        component: manage,
        name: "",
        children: [
            {
                path: "",
                component: home,
                meta: []
            },
            {
                path: "/mallList",
                component: mallList,
                meta: ["数据管理", "门店列表"]
            },
            {
                path: "/tickId/:id",
                component: tick,
                meta: ["基础信息管理", "小票格式管理"]
            },
            {
                path: "/tickList",
                component: tickList,
                meta: ["基础信息管理", "小票格式列表"]
            },
            {
                path: "/refundReason",
                component: refundReason,
                meta: ["数据管理", "退货原因列表"]
            },
            {
                path: "/sysRole",
                component: sysRoleList,
                meta: ["数据管理", "角色列表"]
            },
            {
                path: "/skfsList",
                component: skfsList,
                meta: ["数据管理", "收款方式"]
            },
            {
                path: "/shopList",
                component: shopList,
                meta: ["数据管理", "店铺信息"]
            },
            {
                path: "/spflList",
                component: spflList,
                meta: ["数据管理", "商品分类定义"]
            },
            {
                path: "/spsbList",
                component: spsbList,
                meta: ["数据管理", "商品商标定义"]
            },
            {
                path: "/sktList",
                component: sktList,
                meta: ["基础信息管理", "收款台管理"]
            },
            {
                path: "/goodsList",
                component: goodsList,
                meta: ["基础信息管理", "商品管理"]
            },
            {
                path: "/personList",
                component: personList,
                meta: ["基础信息管理", "人员管理"]
            },
            {
                path: "/xtczyList",
                component: xtczyList,
                meta: ["系统管理", "操作员管理"]
            },
            {
                path: "/coupGrantRuleList",
                component: coupGrantRuleList,
                meta: ["会员权益管理", "优惠券发放规则管理"]
            },
            {
                path: "/coupPayRuleList",
                component: coupPayRuleList,
                meta: ["会员权益管理", "优惠券用券规则管理"]
            },
            {
                path: "/yhqffdList",
                component: yhqffdList,
                meta: ["会员权益管理", "优惠券发券单据管理"]
            },
            {
                path: "/yhqsydList",
                component: yhqsydList,
                meta: ["会员权益管理", "优惠券收券单据管理"]
            },
            {
                path: "/coupDefList",
                component: coupDefList,
                meta: ["会员权益管理", "优惠券定义"]
            },
            {
                path: "/shopSaleDetailList",
                component: shopSaleDetailList,
                meta: ["报表管理", "POS销售明细"]
            },
            {
                path: "/addShop",
                component: addShop,
                meta: ["添加数据", "添加商铺"]
            },
            {
                path: "/addGoods",
                component: addGoods,
                meta: ["添加数据", "添加商品"]
            },
            {
                path: "/userList",
                component: userList,
                meta: ["数据管理", "用户列表"]
            },
            {
                path: "/foodList",
                component: foodList,
                meta: ["数据管理", "食品列表"]
            },
            {
                path: "/orderList",
                component: orderList,
                meta: ["数据管理", "订单列表"]
            },
            {
                path: "/adminList",
                component: adminList,
                meta: ["数据管理", "管理员列表"]
            },
            {
                path: "/visitor",
                component: visitor,
                meta: ["图表", "用户分布"]
            },
            {
                path: "/newMember",
                component: newMember,
                meta: ["图表", "用户数据"]
            },
            {
                path: "/uploadImg",
                component: uploadImg,
                meta: ["文本编辑", "MarkDown"]
            },
            {
                path: "/vueEdit",
                component: vueEdit,
                meta: ["编辑", "文本编辑"]
            },
            {
                path: "/adminSet",
                component: adminSet,
                meta: ["设置", "管理员设置"]
            },
            {
                path: "/sendMessage",
                component: sendMessage,
                meta: ["设置", "发送通知"]
            },
            {
                path: "/explain",
                component: explain,
                meta: ["说明", "说明"]
            },
            {
                path: "/carduserList",
                component: carduserList,
                meta: ["管理数据", "储值卡账户"]
            },
            {
                path: "/rpairBills",
                component: rpairBills,
                meta: ["管理数据", "修补单据"]
            },
            {
                path: "/frozenBills",
                component: frozenBills,
                meta: ["管理数据", "解冻、冻结单据"]
            },
            {
                path: "/QueryRj",
                component: QueryRj,
                meta: ["管理数据", "日汇总"]
            },
            {
                path: "/QueryTJ",
                component: QueryTJ,
                meta: ["管理数据", "员工推荐报表"]
            },
            {
                path: "/QueryMDJX",
                component: QueryMDJX,
                meta: ["管理数据", "门店支付明细"]
            },
            {
                path: "/QueryMDHZJX",
                component: QueryMDHZJX,
                meta: ["管理数据", "门店汇总支付明细"]
            },
            {
                path: "/adminPersons",
                component: adminPersons,
                meta: ["系统管理", "管理员"]
            },
            {
                path: "/adminPersonPwd",
                component: adminPersonPwd,
                meta: ["系统管理", "修改密码"]
            }
        ]
    }
];

export default new Router({
    routes,
    strict: process.env.NODE_ENV !== "production"
});
